package com.ymatou.iapi.couponservice.service;

import org.json.JSONObject;

import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;
/**
*获取用户可用的优惠券数量Call
*FreeMaker Template自动生成代码
*/
public class getUserUsableCouponQuantityCall extends YmatouBaseCall{
	private static String opurl ="api/Promotion/getUserUsableCouponQuantity";
	
	public getUserUsableCouponQuantityCall() {
		super(EnvSetup.getSystemUrl("couponservice"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	public String getStatusCode1() {
		return getString("statusCode");
	}

	public String getMessage() {
		return getString("message");
	}

	public String getData() {
		return getString("data");
	}
	
	/**
	 * 获取Code
	 * 
	 * @return
	 */
	public String getQuantity() {
		String Code = null;
		try {
			Code = new JSONObject(getData()).getString("quantity");
		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}

}